'use strict';
game.import('character', function (lib, game, ui, get, ai, _status) {
	return {
		name: 'tiaozhan',
		connect: true,
		character: {
		},
		characterIntro: {
		},
		card: {
			Cmo: {
				fullskin: true,
				type: 'basic',
				enable: true,
				selectTarget: true,
				filterTarget: function (card, player, target) {
					return true;
				},
				content: function () {
					if (target != player)
						_status.score++;
				},
			},
			Cyangtao: {
				fullskin: true,
				type: 'basic',
				enable: true,
				selectTarget: -1,
				cardcolor: 'red',
				toself: true,
				filterTarget: function (card, player, target) {
					return player == target;
				},
				content: function () {
					player.gainMaxHp();
				},
			},

		},
		skill: {
			//shuangren
			Cqingchun: {
				audio: 2,
				trigger: { player: 'useCard' },
				forced: true,
				filter: function (event, player) {
					if (_status.currentPhase != player) return false;
					var evt = player.getLastUsed(1);
					if (!evt) return false;
					var type1 = get.type(evt.card);
					var type2 = get.type(event.card);
					return type1 && type2 && type1 != 'none' && type2 != 'none' && type1 != type2;
				},
				content: function () {
					player.draw();
				},
			},
			Cyunlv: {
				audio: 2,
				trigger: { player: 'phaseDrawBegin2' },
				forced: true,
				filter: function (event, player) {
					return !event.numFixed;
				},
				content: function () {
					trigger.num += 2;
					player.skip('phaseDiscard');
				},
			},
			Cqiurao: {
				audio: 2,
				unique: true,
				trigger: { player: 'dying' },
				mark: true,
				limited: true,
				init: function (player) {
					player.storage.Cqiurao = false;
				},
				filter: function (event, player) {
					if (player.storage.Cqiurao) return false;
					if (player.hp < 1) return true;
					return false;
				},
				content: function () {
					'step 0'
					player.awakenSkill('Cqiurao');
					player.storage.Cqiurao = true;
					'step 1'
					player.draw(2);
					'step 2'
					if (player.hp < 3) {
						player.recover(3 - player.hp);
					}
				},
				intro: {
					content: 'limited'
				}
			},
			Cyouxi: {
				trigger: {
					player: 'phaseBefore',
				},
				filter: function (event, player) {
					return true;
				},
				content: function () {
					if (_status.lengends) game.over();
					_status.nuqi -= 15;
					_status.lasttime -= 15;
					trigger.cancel();
				},
				audio: 2,
				forced: true,
				locked: false,
			},
			Ccount: {
				audio: 2,
				trigger: { global: 'useCard' },
				forced: true,
				popup: false,
				filter: function (event, player) {
					return event.player != player;
				},
				content: function () {
					if (!trigger.player.storage.Ccount) trigger.player.storage.Ccount = 0;
					trigger.player.storage.Ccount++;
					trigger.player.storage.Ccount %= 4;
					console.log(trigger.player.storage.Ccount);
				},
			},
			Ccountnu: {
				audio: 2,
				trigger: { player: 'useCard' },
				forced: true,
				popup: false,
				filter: function (event, player) {
					return true;
				},
				content: function () {
					if (!_status.leijia) _status.leijia = 0;
					var yes = false;
					for (var i = 0; i < trigger.targets.length; i++)
						if (trigger.targets[i].name == 'beila')
							yes = true;
					if (yes) {
						_status.cntdel = 0;
						_status.leijia++;
						if (_status.leijia >= 5) _status.nuqi += Math.floor(Math.pow(_status.leijia, 5 / 4));
						else _status.nuqi += _status.leijia;
						if (_status.nuqi > 100) _status.nuqi = 100;
					}
					else {
						if (!_status.cntdel) _status.cntdel = 0;
						_status.cntdel++;//记录连续不以拉姐为目标时的次数，用以计算函数
						//		var now=Math.floor(Math.pow(_status.cntdel,2/3))-Math.floor(Math.pow(_status.cntdel-1,2/3));
						_status.leijia--;
						if (_status.leijia < 0) _status.leijia = 0;
						_status.nuqi -= Math.floor(Math.pow(_status.cntdel, 2 / 3));
					}
					console.log(_status.leijia, _status.cntdel);
				},
			},
			Csajiao: {
				audio: 2,
				trigger: { global: 'useCardEnd' },
				forced: true,
				filter: function (event, player) {
					return event.player != player && event.player.storage.Ccount == 0 && _status.nuqi > 20 && _status.nuqi <= 40;
				},
				content: function () {
					'step 0'
					trigger.player.chooseToDiscard('弃置一张牌，或者受到1点伤害', 1);
					'step 1'
					if (!result.bool) {
						trigger.player.damage();
					}

				},
			},
			Cbianda: {
				audio: 2,
				trigger: { global: 'useCardEnd' },
				forced: true,
				filter: function (event, player) {
					return event.player != player && event.player.storage.Ccount == 0 && _status.nuqi > 40 && _status.nuqi <= 70;
				},
				content: function () {
					'step 0'
					trigger.player.chooseToDiscard('弃置两张牌，或者受到2点伤害', 2);
					'step 1'
					if (!result.bool) {
						trigger.player.damage(2);
					}

				},
			},
			Clianji: {
				audio: 2,
				trigger: { global: 'useCardEnd' },
				forced: true,
				filter: function (event, player) {
					return event.player != player && event.player.storage.Ccount == 0 && _status.nuqi > 70 && _status.nuqi <= 99;
				},
				content: function () {
					'step 0'
					event.cnt = 0;
					'step 1'
					trigger.player.chooseToDiscard('弃置一张牌，或者受到1点伤害', 1);
					'step 2'
					if (!result.bool) {
						trigger.player.damage();
					}
					event.cnt++;
					if (event.cnt < 3) {
						event.goto(1);
					}
				},
			},
			Cnaxia: {
				audio: 2,
				trigger: { global: 'useCardEnd' },
				forced: true,
				filter: function (event, player) {
					return event.player != player && event.player.storage.Ccount == 0 && _status.nuqi == 100;
				},
				content: function () {
					trigger.player.die();
				},
			},

			//shuishierciyuan
			C2zibi: {
				mod: {
					globalTo: function (from, to, distance) {
						return distance + ((_status.level == 1 || _status.level == 2) ? 2 : (_status.level == 3 || _status.level == 4) ? 1 : 0);
					}
				}

			},
			C2xueyin: {
				audio: 2,
				filter: function (event, player) {
					return player.countCards('hes', { color: 'black' }) > 0;
				},
				enable: 'chooseToUse',
				filterCard: function (card) {
					return get.color(card) == 'black';
				},
				viewAs: { name: 'caiming' },
				check: function (card) {
					return 7 - get.value(card);
				},
				position: 'hes',
				prompt: '将一张黑色牌当猜名使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'caiming' }, player, target);
						}
					},
					threaten: 1.8
				}
			},
			C2ciyuan: {
				audio: 2,
				enable: 'phaseUse',
				discard: false,
				lose: false,
				delay: 0,
				usable: 1,
				filterTarget: function (card, player, target) {
					return true;
				},

				filter: function (event, player) {
					return true;
				},
				content: function () {
					'step 0'
					target.chooseToDiscard('弃置若干张牌，若弃置点数之和不小于13，可令珈乐再次发动该技能', [1, Infinity], true, 'he').ai = function (card) {
						if (get.attitude(target, player) > 0) {
							if (!event.yes) {
								var n = target.countCards('he');
								var cards = target.getCards('he');
								var w = [];
								var v = [];
								for (var i = 1; i <= n; i++) {
									w[i] = get.number(cards[i - 1]);
									v[i] = get.value(cards[i - 1]);
									if (cards[i - 1].name == 'du')
										v[i] = 0;
								}

								var path = new Array();
								for (var i = 0; i <= n; i++) {
									path[i] = new Array(14);
									for (var j = 0; j <= 13; j++) {
										path[i][j] = 0;
									}
								}
								var dp = [];
								for (var i = 0; i <= 13; i++) {
									dp[i] = 100;
								}
								for (var i = 1; i <= n; i++) {
									for (var j = 13; j >= 1; j--) {
										//		console.log(i,j,w[i],v[i],dp);
										if (j <= w[i] && dp[j] > v[i]) {
											path[i][j] = 1;
											dp[j] = v[i];
										}
										else if (j > w[i] && dp[j] > dp[j - w[i]] + v[i]) {
											path[i][j] = 1;
											dp[j] = dp[j - w[i]] + v[i];
										}
									}
								}
								event.list = [];
								var i = n, j = 13;
								while (i && j) {
									if (path[i][j] == 1) {
										event.list.push(cards[i - 1]);
										j -= w[i];
									}
									i--;
								}
								event.yes = true;
							}
							if (event.yes) {
								if (!event.list.length) {
									if (ui.selected.cards.length) return false;
									return 7 - get.value(card);
								}
								else {
									for (var i = 0; i < event.list.length; i++) {
										if (event.list[i] == card)
											return 10;
									}
									return false;
								}
							}
						}
						else {
							if (ui.selected.cards.length) return false;
							return 7 - get.value(card);
						}

					}
					'step 1'
					if (result.cards) {
						var num = 0;
						for (var i = 0; i < result.cards.length; i++) {
							num += result.cards[i].number;
						}
						if (num < 13) {
							player.draw(4);
						}
					}
				},
				ai: {
					order: 15,
					result: {
						target: 2,
						player: function (player) {
							var num = 0;
							var players = game.filterPlayer();
							for (var i = 0; i < players.length; i++) {
								var att = get.attitude(player, players[i]);
								if (att > 0) num++;
							}
							return num / 2;
						}
					},
					threaten: 2.0
				}
			},
			C2shenyang: {
				audio: 2,
				trigger: { player: 'damageEnd' },
				filter: function (event, player) {
					return true;
				},
				content: function () {
					var players = game.filterPlayer();
					for (var i = 0; i < players.length; i++) {
						if (players[i] != player)
							players[i].turnOver();
					}
					player.draw(2);
				},
				ai: {
					threaten: 2.2,
				},
			},
			C2ranyou: {
				forced: true,
				popup: false,
				audio: 2,
				trigger: { global: 'damageEnd' },
				filter: function (event, player) {
					return player.countCards('h') > 0 && player != event.player&& event.player.isAlive();
				},
				content: function () {
					'step 0'
					player.chooseCard('h', '是否将一张手牌交给该角色').set('ai', function (card) {
						if (get.attitude(player, trigger.player) < 0 && card.name == 'du') return 20;
						if (get.attitude(player, trigger.player) < 0) return false;
						return 7 - get.value(card);
					});
					"step 1"
					if (result.cards) {
						player.logSkill('ranyou', trigger.player);
						trigger.player.gain(result.cards, player, 'giveAuto');
					}
				},
				ai: {
					expose: 0.2,
				},
			},
			C2keai: {
				audio: 2,
				delay: 0,
				selectCard:1,
				filterCard:true,
				logTarget: 'target',
				selectTarget: 1,
				filterTarget: true,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					return game.hasPlayer(function (current) {
						return current.hp != current.maxHp;
					});
				},
				filterTarget: function (event, player, target) {
					return target.hp != target.maxHp;
				},
				content: function () {
					'step 0'
					target.recover();
					'step 1'
					if (target.hp != target.maxHp)
						target.draw();
				},
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 11,
					threaten: 1.5,
					result: {
						target: function (player, target) {
							if (target.hp == 1) return 10;
							return 5;
						}
					}
				}
			},
			C2danda: {
				audio: 2,
				filter: function (event, player) {
					return player.countCards('hes', { type: 'basic' }) > 0;
				},
				usable: 1,
				enable: 'chooseToUse',
				filterCard: function (card) {
					return get.type(card) == 'basic';
				},
				position: 'hes',
				viewAs: { name: 'shunshou' },
				prompt: '将一张基本牌当顺手牵羊使用',
				check: function (card) { return 7 - get.value(card) },
				ai: {
					threaten: 1.5
				}
			},
			C2tiwen: {
				forced: true,
				popup: false,
				audio: 2,
				trigger: {
					player: ['phaseBegin'],
				},
				filter: function (event, player) {
					return _status.list.length && _status.level != 6;
				},
				content: function () {
					'step 0'
					var num = Math.floor(Math.random() * (_status.list.length+19));
					if(num>=_status.list.length) num-=19;
					event.num = num;
					game.me.chooseControl(_status.choose1[num], _status.choose2[num], _status.choose3[num], function (event, player) {
						return Math.floor(Math.random() * 3);
					}).set('prompt', '答题').set('prompt2', _status.list[num]);
					"step 1"
					if (result.control === _status.answer[event.num]) {
						game.me.showStr('<span style="color:#FFE405">恭喜你，回答正确</span>');
						game.me.draw();
						if (_status.level != 6) {
							_status.kyoani.remove(_status.list[event.num]);
							_status.touhou.remove(_status.list[event.num]);
							_status.exp++;
							_status.list.remove(_status.list[event.num]);
							_status.choose1.remove(_status.choose1[event.num]);
							_status.choose2.remove(_status.choose2[event.num]);
							_status.choose3.remove(_status.choose3[event.num]);
							_status.answer.remove(_status.answer[event.num]);
						}
					}
					else {
						game.me.showStr('<span style="color:#BB303F">哎呀，回答错误</span>');
					}
				},
			},
			C2jiejie: {
				forced: true,
				audio: 'jiejie',
				trigger: { player: 'phaseBegin' },
				content: function () {
					var list = ['C2fengmo', 'C2saiqian', 'C2erchong', 'C2fengyin'];
					var num = Math.floor(Math.random() * 4);
					//	var num=3;
					player.addTempSkill(list[num], { player: 'phaseBeginStart' });
				},
				ai: {
					threaten: 2.3,
				},
			},
			C2fengmo: {
				audio: 'JJfengmo',
				filter: function (event, player) {
					return player.countCards('h', { type: 'trick' }) > 0;
				},
				discard: false,
				lose: false,
				delay: 0,
				logTarget: 'target',
				enable: 'phaseUse',
				usable: 1,
				filterCard: function (card) {
					return get.type(card, 'trick') == 'trick';
				},
				filterTarget: function (card, player, target) {
					return player.canUse({ name: 'lebu', cards: ui.selected.cards }, target);
				},
				content: function () {
					'step 0'
					player.useCard({ name: 'lebu' }, target, cards).audio = false;
					'step 1'
					if (target.storage.disableEquip != undefined && target.storage.disableEquip.length < 5) {
						var list = ['equip1', 'equip2', 'equip6', 'equip5'];
						for (var i = 0; i < target.storage.disableEquip.length; i++) {
							if (target.storage.disableEquip[i] == 'equip3' || target.storage.disableEquip[i] == 'equip4')
								list.remove('equip6');
							list.remove(target.storage.disableEquip[i]);
						}
						player.chooseControl(list, true).set('ai', function (event, player) {
							if (list.contains('equip1')) return 'equip1';
							if (list.contains('equip2')) return 'equip2';
							if (list.contains('equip6')) return 'equip6';
							if (list.contains('equip5')) return 'equip5';
						});
					}
					else {
						event.finish();
					}
					'step 2'
					if (result.control) {
						if(result.control=='equip6'){
							target.disableEquip('equip3');
							target.disableEquip('equip4');
						}
						else 
						target.disableEquip(result.control);
					}
				},
				position: 'hs',
				prompt: '将一张锦囊牌当乐不思蜀使用',
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'lebu' }, player, target) - 3;
						}
					},
					threaten: 1.8
				}
			},
			C2saiqian: {
				audio: 'JJsaiqian',
				discard: false,
				lose: false,
				delay: 0,
				logTarget: 'target',
				enable: 'phaseUse',
				usable: 1,
				filterTarget: function (card, player, target) {
					return player != target;
				},
				content: function () {
					'step 0'
					target.chooseCard('hes', '【塞钱】：请交给其一张牌，否则受到2点自适应伤害');
					'step 1'
					if (!result.bool) {
						target.autoDamage(2);
					}
					else {
						player.gain(result.cards, target, 'give');
					}
				},
				prompt: '令一名其他角色交给你一张牌，否则其受到2点自适应伤害',
				ai: {
					order: 10,
					result: {
						target: -10,
					},
					threaten: 2
				}
			},
			C2erchong: {
				audio: 2,
				trigger: { global: 'phaseJudgeAfter' },
				filter: function (event, player) {
					if (event.player == player) return false;
					return true;
				},
				direct: true,
				content: function () {
					"step 0"
					player.chooseBool(get.prompt("JJerchong"), "是否与" + get.translation(trigger.player) + "交换摸牌和出牌阶段").set('ai', function () {
						att = get.attitude(player, event.player);
						if (att >= 0) return false;
						return Math.random() >= 0.5 ? true : false;
					});
					"step 1"
					if (result.bool) {
						console.log(trigger.player, player, 'asddd');
						player.logSkill('JJerchong');
						game.log('#b' + get.translation(player), '进行二重大结界赋予的摸牌和出牌阶段');
						trigger.player.skip('phaseDraw');
						trigger.player.skip('phaseUse');
						var next1 = player.phaseDraw();
						var next2 = player.phaseUse();
						trigger.next.push(next1);
						trigger.next.push(next2);
						player.addTempSkill('JJerchong2', { player: 'phaseEndStart' });
						player.storage.JJerchong2 = trigger.player;
						player.removeSkill('JJerchong');
						trigger.player.markSkill('JJerchong2');
					}
				},
			},
			C2erchong2: {
				audio: 'JJerchong',
				trigger: { player: 'phaseJudgeAfter' },
				direct: true,
				content: function () {
					player.logSkill('C2erchong');
					player.skip('phaseDraw');
					player.skip('phaseUse');
					var next1 = player.storage.C2erchong2.phaseDraw();
					var next2 = player.storage.C2erchong2.phaseUse();
					trigger.next.push(next1);
					trigger.next.push(next2);
					delete player.storage.C2erchong2;
				}
			},
			C2fengyin: {
				audio: 'JJfengyin',
				trigger: { global: 'phaseUseBefore' },
				direct: true,
				filter: function (event, player) {
					if (player.countCards('h', { color: 'red' })) return true;
					return false;
				},
				content: function () {
					"step 0"
					player.chooseCard('h', player.countCards('h', { color: 'red' }), get.prompt("C2fengyin"), "弃置所有红色牌", function (card) {
						return get.color(card) == 'red';
					}).set('ai', function (card) {
						return true;
					});
					"step 1"
					if (result.bool) {
						player.logSkill('C2fengyin');
						trigger.cancel();
						player.discard(result.cards);
						event.num = result.cards.length;
						event.cnt = 0;
					}
					else event.finish();
					'step 2'
					game.me.chooseToDiscard('弃置一张基本牌，或者受到1点伤害', 1, function (card) {
						return get.type(card) == 'basic';
					});
					'step 3'
					if (!result.bool) {
						game.me.damage();
					}
					event.cnt++;
					if (event.cnt < event.num) {
						event.goto(2);
					}
				}
			},
			C2danmu: {
				trigger: {
					player: "useCardAfter",
				},
				froced: true,
				filter: function (event, player) {
					return get.color(event.card) == 'red' && game.hasPlayer(function (current) {
						return player.canUse({ name: 'sha' }, current);
					});
				},
				content: function () {
					player.chooseUseTarget({ name: 'sha' }, true);
				},
			},


			//wudouhuis1
			C3countCard:{
				trigger: {
					player: ["useCardAfter",'respondAfter'],
				},
				direct: true,
				content: function () {
						game.Ccard_delete(trigger.card.name,player);
				},
			},
			C3countDamage:{
				trigger: {
					player: ["damageEnd"],
				},
				direct: true,
				content: function () {
					if(player.name=='beila')
					  _status.jiaran+=trigger.num;
					else 
					  _status.beila+=trigger.num;
				},
			},
			C3wuting:{
				trigger: {
					player: "useCardAfter",
				},
				forced:true,
				filter: function (event, player) {
					if(_status.round%6!=0) delete player.storage.C3wuting;
					return _status.round%6==0&&!player.storage.C3wuting;
				},
				content: function () {
					game.log('#b', player, '开始了一段', '#gFreeStyle');
					player.showStr('<span style="color:#DB7D74">贝拉开启了专属的FreeStyle时间！！！</span>');
					player.C3freestyle();
					player.storage.C3wuting=true;
				},
			},
			C3zhaiqu:{
				trigger: {
					player: "useCardAfter",
				},
				forced:true,
				filter: function (event, player) {
					if(_status.round%5!=0) delete player.storage.C3zhaiqu;
					return _status.round%5==0&&!player.storage.C3zhaiqu;
				},
				content: function () {
					player.showStr('<span style="color:#E799B0">嘉然消除了最少一组期望卡！！！</span>');
					game.Ccard_zhaiqudelete(player);
					player.storage.C3zhaiqu=true;
				},
			},


			//剧情技能
			JQhuifu: {
				delay: 0,
				selectCard:1,
				filterCard:true,
				logTarget: 'target',
				selectTarget: 1,
				filterTarget: true,
				enable: 'phaseUse',
				usable: 1,
				filter: function (event, player) {
					return game.hasPlayer(function (current) {
						return current.hp != current.maxHp;
					});
				},
				filterTarget: function (event, player, target) {
					return target.hp != target.maxHp;
				},
				content: function () {
					'step 0'
					target.recover();
					'step 1'
					if (target.hp != target.maxHp)
						target.draw();
				},
				check: function (card) { return 8 - get.value(card) },
				ai: {
					order: 11,
					threaten: 1.5,
					result: {
						target: function (player, target) {
							if (target.hp == 1) return 10;
							return 5;
						}
					}
				}
			},
			JQjingong: {
				firstDo: true,
				trigger: { player: 'useCard1' },
				forced: true,
				filter: function (event, player) {
					if (!event.audioed && event.card.name == 'sha' && player.countUsed('sha', true) > 1 && event.getParent().type == 'phase')
						return true;
					if (!event.audioed && event.card.name == 'jiu' && player.countUsed('jiu', true) > 1 && event.getParent().type == 'phase')
						return true;
					return false;
				},
				content: function () {
					trigger.audioed = true;
				},
				mod: {
					cardUsable: function (card, player, num) {
						if (card.name == 'jiu') return Infinity;
						if (card.name == 'sha') return Infinity;
					}
				},
				ai: {
					unequip: true,
					skillTagFilter: function (player, tag, arg) {
						if (!get.zhu(player, 'shouyue')) return false;
						if (arg && arg.name == 'sha') return true;
						if (arg && arg.name == 'jiu') return true;
						return false;
					}
				}
			},
			JQfangyu: {
				audio: 2,
				trigger: { player: 'damageEnd' },
				filter: function (event, player) {
					return (event.source != undefined && event.num > 0);
				},
				check: function (event, player) {
					return (get.attitude(player, event.source) <= 0);
				},
				logTarget: 'source',
				preHidden: true,
				content: function () {
					"step 0"
					event.num = trigger.num;
					"step 1"
					player.judge(function (card) {
						if (get.color(card) == 'red') return 1;
						return 0;
					});
					"step 2"
					if (result.color == 'black') {
						if (trigger.source.countCards('hej')) {
							player.discardPlayerCard(trigger.source, 'hej', true);
						}
					}
					else if (result.color == 'red'&&trigger.source.isIn()) {
						trigger.source.damage();
					}
					event.num--;
					if (event.num > 0) {
						player.chooseBool(get.prompt2('JQfangyu'));
					}
					else {
						event.finish();
					}
					"step 3"
					if (result.bool) {
						player.logSkill('JQfangyu', trigger.source);
						event.goto(1);
					}
				},
				ai: {
					maixie_defend: true,
					expose: 0.4
				}
			},
			JQwusheng:{
				audio:2,
				enable:['chooseToRespond','chooseToUse'],
				filterCard:function(card,player){
					if(get.zhu(player,'shouyue')) return true;
					return get.color(card)=='red';
				},
				position:'hes',
				viewAs:{name:'sha'},
				viewAsFilter:function(player){
					if(get.zhu(player,'shouyue')){
						if(!player.countCards('hes')) return false;
					}
					else{
						if(!player.countCards('hes',{color:'red'})) return false;
					}
				},
				prompt:'将一张红色牌当杀使用或打出',
				check:function(card){return 4-get.value(card)},
				ai:{
					skillTagFilter:function(player){
						if(get.zhu(player,'shouyue')){
							if(!player.countCards('hes')) return false;
						}
						else{
							if(!player.countCards('hes',{color:'red'})) return false;
						}
					},
					respondSha:true,
				}
			},
			JQmanzu: {
				audio: 2,
				filter: function (event, player) {
					return player.countCards('h', { color: 'black' }) > 0;
				},
				enable: 'chooseToUse',
				filterCard: function (card) {
					return get.color(card) == 'black';
				},
				viewAs: { name: 'manzu_delay' },
				check: function (card) {
					return 7 - get.value(card);
				},
				position: 'h',
				prompt: '将一张黑色手牌当【延迟满足】延迟使用',
				check: function (card) { return 15 - get.value(card) },
				ai: {
					order: 10,
					result: {
						target: function (player, target) {
							return get.effect(target, { name: 'manzu_delay' }, player, target);
						}
					},
					threaten: 1.8
				}
			},
			JQcainv: {
				audio: 2,
				forced: true,
				trigger: { player: 'compare', target: 'compare' },
				filter: function (event, player) {
					if (event.iwhile) return false;
					return true;
				},
				content: function () {
					game.log(player, '拼点牌点数', '#y+2');
					if (player == trigger.player) {
						trigger.num1 += 2;
					}
					else {
						trigger.num2 += 2;
					}
				}
			},
			JQzhaiqu: {
				mod: {
					aiValue: function (player, card, num) {
						if (get.name(card) != 'shan' && get.color(card) != 'black') return;
						var cards = player.getCards('hs', function (card) {
							return get.name(card) == 'shan' || get.color(card) == 'black';
						});
						cards.sort(function (a, b) {
							return (get.name(b) == 'shan' ? 1 : 2) - (get.name(a) == 'shan' ? 1 : 2);
						});
						var geti = function () {
							if (cards.contains(card)) {
								return cards.indexOf(card);
							}
							return cards.length;
						};
						if (get.name(card) == 'shan') return Math.min(num, [6, 4, 3][Math.min(geti(), 2)]) * 0.6;
						return Math.max(num, [6.5, 4, 3][Math.min(geti(), 2)]);
					},
					aiUseful: function () {
						return lib.skill.qingguo.mod.aiValue.apply(this, arguments);
					},
				},
				locked: false,
				audio: 2,
				enable: ['chooseToRespond', 'chooseToUse'],
				filterCard: function (card) {
					return get.color(card) == 'black';
				},
				position: 'hes',
				viewAs: { name: 'shan' },
				viewAsFilter: function (player) {
					if (!player.countCards('hes', { color: 'black' })) return false;
				},
				prompt: '将一张黑色牌当闪打出',
				check: function () { return 1 },
				ai: {
					order: 2,
					respondShan: true,
					skillTagFilter: function (player) {
						if (!player.countCards('hes', { color: 'black' })) return false;
					},
					effect: {
						target: function (card, player, target, current) {
							if (get.tag(card, 'respondShan') && current < 0) return 0.6
						}
					}
				}
			},
		},
		challenge: {
		},
		dynamicTranslate: {
		},
		translate: {
			//shuangren
			Cqingchun: '清纯',
			Cyunlv: '韵律',
			Cqiurao: '求饶',
			Cyouxi: '游戏',
			Csajiao: '撒娇',
			Cbianda: '鞭打',
			Clianji: '连击',
			Cnaxia: '拿下',

			Cqingchun_info: '锁定技，当你使用的牌与上一张牌类别不同时，你摸一张牌。',
			Cyunlv_info: '锁定技，摸牌阶段，你多摸两张牌，你跳过弃牌阶段。',
			Cqiurao_info: '限定技，当你进入濒死状态时，摸两张牌，然后回复至1点体力。',
			Cyouxi_info: '锁定技，拉姐正在游戏中，她不会做出任何操作。',
			Csajiao_info: '锁定技，怒气21-40，每当乃琳使用4张牌，乃琳弃置一张牌，否则受到1点伤害。',
			Cbianda_info: '锁定技，怒气41-70，每当乃琳使用4张牌，乃琳弃置两张牌，否则受到2点伤害。',
			Clianji_info: '锁定技，怒气71-99，每当乃琳使用4张牌，乃琳依次弃置三张牌，每少弃一张受到1点伤害。',
			Cnaxia_info: '锁定技，怒气100，乃琳立即死亡。',

			Cmo: '摸',
			Cmo_info: '出牌阶段对一名角色使用，若目标不为你，你获得一分。',
			Cyangtao: '杨桃',
			Cyangtao_info: '出牌阶段对自己使用，你增加一点体力上限。',


			//shuishierciyuan
			C2zibi: '自闭',
			C2xueyin: '学音',
			C2ciyuan: '刺螈',
			C2shenyang: '沈阳',
			C2ranyou: '然佑',
			C2keai: '可爱',
			C2danda: '胆大',
			C2tiwen: '提问',
			C2jiejie: '结界',
			C2fengmo: '封魔',
			C2saiqian: '塞钱',
			C2erchong: '二重',
			C2fengyin: '封印',
			C2danmu: '弹幕',

			C2zibi_info: '锁定技，锁定技，其他角色计算与你的距离+X。（X在1、2级时为2；3、4级时为1；5、6级时为0）',
			C2xueyin_info: '出牌阶段，你可以将一张黑色牌当【猜名】使用。',
			C2ciyuan_info: '出牌阶段限一次，你令一名角色弃置任意张牌，若弃置点数之和小于13，你摸四张牌。',
			C2shenyang_info: '锁定技，当你受到伤害时，令除你以外的所有角色翻面,然后你摸两张牌。',
			C2ranyou_info: '一名角色受到伤害后，你可以交给其一张手牌。',
			C2keai_info: '出牌阶段，你可以弃置一张牌，令一名角色回复1点体力。若该角色仍受伤，令其摸一张牌。',
			C2tiwen_info: '锁定技，若珈乐不为6级，回合开始时，令珈乐回答一道二次元题目。若珈乐答对，其摸一张牌。',
			C2danda_info: '出牌阶段限一次，你可以将一张牌当【顺手牵羊】使用。',
			C2jiejie_info: '锁定技，你的回合开始时，你随机获得一个符卡技能直到你的下个回合开始。',
			C2fengmo_info: '出牌阶段限一次，你将一张锦囊牌当【乐不思蜀】对一名其他角色使用，然后废除其装备区的一个装备栏。',
			C2saiqian_info: '出牌阶段限一次，你令其他角色交给你一张牌，否则其受到2点自适应伤害。',
			C2erchong_info: '每轮限一次，一名其他角色的判定阶段结束后，你可以与其交换摸牌阶段与出牌阶段。',
			C2fengyin_info: '出牌阶段开始前，你可以弃置所有红色手牌并跳过出牌阶段。然后令一名其他角色依次弃置等量的基本牌，每少弃置一张便受到1点伤害。',
			C2danmu_info: '锁定技，你的回合内，每当你使用一张红色牌后，视为使用一张杀。',

			//wudouhuis1
			C3wuting: '舞庭',
			C3zhaiqu: '宅曲',

			C3wuting_info: '锁定技，每过6轮，当你使用牌后，可以获得一次自由发挥。',
			C3zhaiqu_info: '锁定技，每过5轮，当你使用牌后，可以随机消除期望栏上只有一张期望卡的一组。',
			//成就 

			//剧情技能
			JQhuifu:'回复',
			JQhuifu_info: '出牌阶段，你可以弃置一张牌，令一名角色回复1点体力。若该角色仍受伤，令其摸一张牌。',
			JQjingong:'强攻',
			JQjingong_info:'锁定技，你使用【杀】和【酒】无次数限制。',
			JQfangyu:'反击',
			JQfangyu_info:'当你受到1点伤害后，你可以进行判定，若结果为：红色，你对伤害来源造成1点伤害；黑色，你弃置其一张牌。',
			JQwusheng:'舞魂',
			JQwusheng_info:'你可以将一张红色牌当杀使用或打出。',
			JQmanzu:'满足',
			JQmanzu_info:'出牌阶段，你可以将一张黑色牌当【延迟满足】延迟使用。',
			JQcainv:'才女',
			JQcainv_info:'锁定技，当你的拼点牌亮出后，其点数+2。',
			JQzhaiqu:'宅曲',
			JQzhaiqu_info:'你可以将一张黑色牌当闪使用或打出。',
		},
	};
});
